/* Copyright 2001,2002,2003 NAH6 BV
 * All Rights Reserved
 *
 *  $Header: /var/lib/cvs/secphone/ui/database/CeRecord.h,v 1.3 2003/11/21 12:39:24 itsme Exp $
 *
 *
 */


#ifndef __CERECORD_H__

#include <windows.h>

#define FIELDID(id, type)  ((id)<<16 | (type))

class CeRecord {
public:
    CeRecord(int nFields);
    CeRecord(const CeRecord &rec);
    CeRecord(CEOID oid, const CEPROPVAL *props, int nProps);
    ~CeRecord();

    int NrOfFields() const;
    CEPROPVAL *PropValArray() const;
    
    CEPROPVAL *UpdatedPropValArray();
    int NrOfUpdatedFields();

    WCHAR *GetString(CEPROPID field);
    void SetString(CEPROPID field, WCHAR *szValue);

    bool AddBoolean(CEPROPID field, BOOL nValue);
    bool AddSInt16(CEPROPID field, long nValue);
    bool AddSInt32(CEPROPID field, long nValue);
    bool AddString(CEPROPID field, const WCHAR *szValue);
    bool AddString(CEPROPID field, const char *szValue);
    bool AddTimestamp(CEPROPID field, const FILETIME *ft);
    bool AddUInt16(CEPROPID field, DWORD nValue);
    bool AddUInt32(CEPROPID field, DWORD nValue);
// omitting methods to handle 64 bit ints, and blobs
//
public:
        CEOID   m_oid;

private:
        int m_nMaxProperties;
        int m_nProperties;
        CEPROPVAL *m_props;

        int m_nUpdatedProperties;
        CEPROPVAL *m_updatedProps;

    void Initialize(int nProps);

    bool AddStringEx(CEPROPID field, WCHAR *szValue);
    bool AddValueEx(int field, int type, DWORD nValue);
    bool AddValueEx2(CEPROPID field, DWORD nValue);

    void CopyPropValArray(const CEPROPVAL *props, int nProps);
    int FindFieldIndex(CEPROPID field);

    void GetUpdatedProps();
};

#define NHDB_MODIFIED  CEDB_PROPNOTFOUND

#define __CERECORD_H__
#endif


